<template>
  <div v-if="loading" class="loading-mask">
    <div class="spinner"></div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      loading: false
    }
  },
  methods: {
    start() {
      this.loading = true
    },
    finish() {
      this.loading = false
    }
  }
}
</script>

<style lang="less" scoped>
.loading-mask{
  width: 100%;
  height: 100%;
  position: absolute;
  background-color: #d5d5d5;
  opacity: 0.5;
  z-index: 2;
}
.spinner{
  width: 80px;
  height: 80px;
  background-color: @primary-color;
  position: fixed;
  left: 50%;
  top: 50%;
  margin-left: -40px;
  margin-top: -40px;
  -webkit-animation: rotateplane 1.2s infinite ease-in-out;
  animation: rotateplane 1.2s infinite ease-in-out;
}

@-webkit-keyframes rotateplane{
  0% {-webkit-transform: perspective(120px);}
  50% {-webkit-transform: perspective(120px) rotateY(180deg);}
  100% {-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg);}
}

@keyframes rotateplane{
  0% {
    transform: perspective(120px) rotateX(0deg) rotateY(0deg);
    -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg);
  }
  50% {
    transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
    -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
  }
  100% {
    transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
    -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
  }
}
</style>
